package com.nwpu.server.admin.app;


import com.nwpu.server.admin.entity.EmbeddingmethodTitleEntity;
import com.nwpu.server.admin.service.EmbeddingmethodTitleService;
import com.nwpu.server.common.response.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.nwpu.server.common.response.R;
import java.util.Arrays;
import java.util.Map;

/**
 * 
 *
 * @author YuXingZh
 * @email 617058979@qq.com
 * @date 2022-04-23 20:17:11
 */
@RestController
@RequestMapping("admin/embeddingmethodtitle")
public class EmbeddingmethodTitleController {
    @Autowired
    private EmbeddingmethodTitleService embeddingmethodTitleService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = embeddingmethodTitleService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		EmbeddingmethodTitleEntity embeddingmethodTitle = embeddingmethodTitleService.getById(id);

        return R.ok().put("embeddingmethodTitle", embeddingmethodTitle);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody EmbeddingmethodTitleEntity embeddingmethodTitle){
		embeddingmethodTitleService.save(embeddingmethodTitle);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody EmbeddingmethodTitleEntity embeddingmethodTitle){
		embeddingmethodTitleService.updateById(embeddingmethodTitle);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		embeddingmethodTitleService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
